Returns the current position of the sound.
#include <Sound.au3>
_SoundPos ( $sSnd_id [, $iMode ] )
Parameters
$sSnd_id | Sound ID (the 'alias') as returned by _SoundOpen or a file |
$iMode | [optional] This flag determines which format the position of the sound is returned in 1 = hh:mm:ss where h = hours, m = minutes and s = seconds 2 = milliseconds |
Return Value
Success: | Sound Position |
Failure: | 0 |
@Error: | 0 = No Error |
1 = $iMode is invalid |
Remarks
None.
Related
_SoundLength
Example
#include <Sound.au3>
;open sound file
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav", "Startup")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
Exit
ElseIf @error = 3 Then
MsgBox(0, "Error", "The alias was invalid")
Exit
ElseIf @extended <> 0 Then
$extended = @extended ;assign because @extended will be set after DllCall
$stText = DllStructCreate("char[128]")
$errorstring = DllCall("winmm.dll","short","mciGetErrorStringA","str",$extended,"ptr",DllStructGetPtr($stText),"int",128)
MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundPlay($sound, 0)
$splashtext = SplashTextOn("Current Position", _SoundPos($sound, 1), 300, 90, Default, Default, 18, Default, 55)
While 1
Sleep(100)
ControlSetText("Current Position", "", "Static1", _SoundPos($sound, 1))
If _SoundPos($sound, 2) = _SoundLength($sound, 2) Then ExitLoop
WEnd
_SoundClose($sound)